t
Essential Mac Methods *381*

Here is a selection of Mac Methods sufficient to handle most types of graphical operations.  It is divided into the following sections:  

Cursor, Pen and Line Drawing, Text, Drawing in Color, Rectangles, Ovals, Round Rectangles, Arcs and Wedges, Bit Transfer, Pictures, Polygons, Points, Resources, Dialogs and Alerts, Graphic Utilities, Miscellaneous Utilities. 

Cursor *381*

__________________________________________
InitCursor *381*

Description:     Sets the current cursor to the standard arrow and sets the cursor level to 0, making the cursor visible.  The cursor level keeps track of the number of times the cursor has been hidden to compensate for nested calls to HideCursor and ShowCursor, explained below.

__________________________________________
SetCursor *382*

Input names:    crsr

Input types:    Cursor

Description:     Sets the current cursor to the given cursor.

__________________________________________
SetCCursor *382*

Input names:     crsr

Input types:     CCrsrHandle

Description:     Allows your application to set a multicolor cursor.

__________________________________________
HideCursor *382*

Description:     Removes the cursor from the screen, restoring the bits under it, and decrements the cursor level.

__________________________________________
ShowCursor*382*

Description:     Increments the cursor level, which may have been decremented by HideCursor, and displays the cursor on the screen if the level becomes 0.

__________________________________________
ObscureCursor *382*

Description:     Hides the cursor until the next time the mouse is moved. Unlike HideCursor, it has no effect on cursor level and must not be balanced by a call to ShowCursor.

__________________________________________
GetCursor *383*

Input names:     cursorID 

Input types:     integer 

Output names:     aCursHandle

Output types:     CursHandle 

Description:     Returns a handle to the cursor having the given resource ID, reading it from the resource file, if necessary.  If the resource can’t be read, GetCursor returns NIL.

       
 You can use any of the following constants to specify cursorID; for more information, see Inside Macintosh.

constant value 

iBeamCursor
1

crossCursor
2

plusCursor
3

watchCursor
4

 Note that arrow is a Mac global which can be passed directly into SetCursor, with no need to call GetCursor first.

__________________________________________
GetCCursor *384*

Input names:     cursorID 

Input types:     integer 

Output names:     CursHandle

Output types:     CCrsrHandle 

Description:     Returns a handle to the color cursor having the given resource ID, reading it from the resource file, if necessary.  If the resource can’t be read, GetCCursor returns NIL.

__________________________________________
DisposCCursor *384*

Input names:     cCursr 

Input types:     CCrsrHandle 

Description:     Disposes of all structures allocated by GetCCursor.

__________________________________________
ShieldCursor *384*

Input names:     shieldRect, offsetPoint  

Input types:     Rect, Point 

Description:     Hides the cursor, if the cursor and the given rectangle intersect.  If they don’t intersect, the cursor remains visible while the mouse isn’t moving, but is hidden when the mouse moves.  Like HideCursor, ShieldCursor decrements the cursor level, and should be balanced by a call to ShowCursor.

__________________________________________
Pen and Line Drawing *384*

The pen and line-drawing routines all depend on the coordinate system of the current grafPort.

__________________________________________
HidePen *384*

Description:     Decrements the pen level by 1:   whenever the pen level is negative, the pen doesn’t draw on the screen. Every call to HidePen should be balanced by a subsequent call to ShowPen.

__________________________________________
ShowPen *385*

Description:     Complement of HidePen; increments the pen level by 1.  If pen level becomes 0, then QuickDraw resumes drawing on the screen.

__________________________________________
GetPen *385*

Input names:     pt 

Input types:     Point

Output names:     pt 

Output types:  
Point

Description:   Returns the current pen location, in the local coordinates of the current grafPort.

__________________________________________
GetPenState *385*

Input names:     pnState 

Input types:   PenState

Output names:   pnState

Output types:  
PenState

Description:   Saves the pen location, size, pattern, and mode in aPenState, to be restored later with SetPenState.  This is useful when calling subroutines that operate in the current port but must change the graphics pen.

__________________________________________
SetPenState *385*

Input names:   pnState

Input types:   PenState

Description:   Sets the pen location, size, pattern and mode in the current grafPort to the values stored in aPenState. This is usually called at the end of a procedure that has altered the pen parameters and wants to restore them to their state at the beginning of the procedure.

__________________________________________
PenSize *386*

Input names:   width, height

Input types:   integer, integer

Description:   Sets the dimensions of the graphics pen in the current grafPort. 

__________________________________________
PenMode *386*

Input names:   mode

Input types:   integer

Description:   Sets the transfer mode through which the pen pattern is transferred onto the bit map when lines or shapes are drawn in the current grafPort. The mode may be any one of the eight pattern transfer modes. If the mode is one of the source transfer modes (or negative), no drawing is performed.

 You can use the following constants to specify the pattern transfer mode; for more information, see Inside Macintosh.

constant value 

patCopy
8

patOr
9

patXor
10

patBic
11

notpatCopy
12

notpatOr
13

notpatXor
14

notpatBic
15

__________________________________________
PenPat  *387*

Input names:   pat

Input types:   Pattern

Description:   Sets the pattern that’s used by the pen in the current grafPort.

 You can access any of the following global variables to specify patterns; for more information, see Inside Macintosh.

Variable Type Initial Setting 

white
Pattern An all-white pattern

black
Pattern
An all-black pattern

gray
Pattern
A 50% gray pattern

ltGray
Pattern
A 25% gray pattern

dkGray
Pattern
A 75% gray pattern

__________________________________________
PenNormal  *387*

Description:   Resets pen to its initial state in the current grafPort:    transfer mode of patCopy, pen size of 1 pixel by 1 pixel, pattern of solid black.

__________________________________________
MoveTo  *387*

Input names:   h, v

Input types:   integer, integer

Description:   Moves pen location to location (h,v) in the local coordinates of the current grafPort. No drawing is performed.

__________________________________________

Move  *387*

Input names:   dh, dv

Input types:   integer, integer

Description:   Moves pen location dh pixels horizontally, dv pixels vertically.  No drawing is performed.

__________________________________________
LineTo  *388*

Input names:   h, v

Input types:   integer, integer

Description:   Draws a line from the current pen location to the location specified (in local coordinates) by h and v.  The new pen location is (h,v) after the line is drawn.

__________________________________________
Line  *388*

Input names:   dh, dv

Input types:   integer, integer

Description:   Draws a line dh pixels horizontally, dv pixels vertically from the current pen location and sets the endpoint of the line as the new pen location after the line is drawn.